package com.alcargo.dao.imp;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.alcargo.dao.NouseDao;
import com.alcargo.model.db.AirWayBill;

public class NouseDaoImp extends HibernateDaoSupport implements NouseDao {
	

	public AirWayBill getAWBbyNo(String str) {
		logger.info("str:"+str);
		Query q = getSession().createQuery("from AirWayBill t where name like :name");
		q.setString("name", str);
		AirWayBill result = null;
		if(q.iterate().hasNext())
		result = (AirWayBill) q.uniqueResult();
		logger.info("obj"+result);
		return result;
	}

	@SuppressWarnings("unchecked")
	public List<AirWayBill> getListbyAWB(AirWayBill awb) {
		Query q = getSession().createQuery("from AirWayBill t where name like :name");
		q.setString("name", awb.getName());
		return q.list();
	}
	

}
